package com.example.desinger.controller;

import com.example.desinger.common.R;
import com.example.desinger.entity.Classroom;
import com.example.desinger.service.ClassRoomService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RequestMapping("/class")
@RestController
public class ClassRoomController {
    @Autowired
    private ClassRoomService classRoomService;

    @GetMapping
    public R<List<Classroom>> selectClassRoomById(){
        List<Classroom> list = classRoomService.list();
        return R.success(list,"查询成功");
    }

    @PostMapping
    public R<String> addClss(@RequestBody Classroom classroom){
        System.out.println(classroom.getNickname());
        return classRoomService.addClass(classroom.getNickname());
    }

    

}
